#ifndef _MOE_REALARRAYSOLUTION
#define _MOE_REALARRAYSOLUTION

#include "engine/Solution.hh"
#include "engine/Random.hh"


class RealArraySolution : public Solution {

protected:

    double *array;
    static int size;

    static double *lowerBounds;
    static double *higherBounds;

public:

    RealArraySolution(int *array);

    RealArraySolution();

    RealArraySolution(RealArraySolution &other);

    virtual ~RealArraySolution();

    virtual double get(int i);

    virtual void set(int i, double value);

    virtual void initialize();

    virtual int length();

    virtual void send(ostream &os);

    virtual Solution *copy();

    virtual bool equals(Solution *solution) {
        RealArraySolution *realArraySolution = (RealArraySolution *) solution;

        for (int i = 0; i < RealArraySolution::size; i++)
            if (array[i] != realArraySolution->array[i])
                return false;

        return true;
    }

    virtual void send(NetStream &stream) {
        Solution::send(stream);

        for (int i = 0; i < RealArraySolution::size; i++)
            stream << array[i];

    }

    virtual void receive(NetStream &stream) {
        Solution::receive(stream);

        for (int i = 0; i < RealArraySolution::size; i++)
            stream >> array[i];
    }


    static int getSize() {
        return size;
    }

    static void setSize(int size) {
        RealArraySolution::size = size;
    }

    static void setLowerBounds(double *lowerBounds) {
        RealArraySolution::lowerBounds = lowerBounds;
    }

    static double *getLowerBounds() {
        return RealArraySolution::lowerBounds;
    }

    static void setHigherBounds(double *higherBounds) {
        RealArraySolution::higherBounds = higherBounds;
    }

    static double *getHigherBounds() {
        return RealArraySolution::higherBounds;
    }

};

#endif


